package cn.edu.scau.cmi.zhuangjunsheng.comprehensiveExperiment;

import java.util.HashSet;
import java.util.Set;

import cn.edu.scau.cmi.zhuangjunsheng.singleton.Chairman;
import cn.edu.scau.cmi.zhuangjunsheng.singleton.Marshal;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class MultitonUI {

	@FXML
	private TextField tf;
	
	@FXML
	private TextArea ta;
	
	@FXML
	public void onTF(ActionEvent av) throws Exception {
		String name = tf.getText();
		//Set<Marshal> marshalSet=new HashSet<Marshal>();
		if(Marshal.marshalSet.size()==10) ta.appendText("已有10位元帅，"+ name + "不能再是元帅了\n");
		else {
			Marshal marshal = Marshal.addInstance(name);
			ta.appendText("当前创建的元帅为" + name + "\n");
		}
		//marshalSet = Marshal.
		
	}

}
